import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/src/cupertino_localizations.dart';
import 'package:flutter_localizations/src/material_localizations.dart';
import 'package:flutter_localizations/src/widgets_localizations.dart';
import 'package:get/get.dart';
import 'package:keep_account/ui/add_work_records.dart';
import 'package:keep_account/ui/home_main.dart';
import 'package:keep_account/ui/splash.dart';
import 'package:keep_account/ui/user_login.dart';
import 'package:keep_account/ui/year_month_day_work_records.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple,background: Theme.of(context).colorScheme.onBackground),
        useMaterial3: true,
        appBarTheme: AppBarTheme(
          elevation: 2,
          shadowColor: Theme.of(context).colorScheme.shadow
        ),
        bottomAppBarTheme: BottomAppBarTheme(
          elevation: 2,
          shadowColor: Theme.of(context).colorScheme.shadow
        )
      ),
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate
      ],
      supportedLocales: const [
        Locale('zh','CN')
      ],
      home: const Splash(),
      builder: EasyLoading.init(),
      getPages: [
        GetPage(name: "/user_login", page: ()=>const UserLogin()),
        GetPage(name: "/home_main", page:()=> const HomeMain()),
        GetPage(name: "/ymd_work_records", page: ()=>const YearMonthDayWorkRecords()),
        GetPage(name: "/add_work_records", page: ()=> const AddWorkRecords()),
      ],
    );
  }
}
